In [14]:
using PyPlot
push!(LOAD_PATH, "../src")
using GP
In [15]:
# smoothness and kernel
Δ = 0.5
ker = Kernel(Δ)
# evaluate the kernel
θs = linspace(-π, π, 1001)
kvals = val(θs, ker)
# plot the kernel
figure(figsize=(3, 2.5))
plot(θs, kvals, linewidth=2, color="k")
xlabel("theta"); ylabel("kernel")
tight_layout()
In [18]:
# number of neurons and conditions to sample the random functions
nnrn, ncond = 4, 1000
# generate tuning curves
θs, xs = tc(ncond, nnrn, ker)
# plot them
figure(figsize=(3, 2.5))
plot(θs, xs, linewidth=2);
xlabel("theta"); ylabel("response")
tight_layout()
In [17]:
figure(figsize=(3, 3))
# do a random projection and look at a 2D image
u = qr(randn(nnrn, 2))[1]
plot((xs * u)[:, 1], (xs * u)[:, 2], "k", linewidth=2)
xticks([]); yticks([])
title("projected manifold")
xlabel("dimension 1"); ylabel("dimension 2")
tight_layout()